home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / MORE.vu < prev    next >
Encoding:
Text File  |  1993-12-20  |  8.6 KB  |  219 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        MORE.vu
  5. #
  6. #    Contains:    Quick look test script for More version 3.1
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #         <2>    12/20/93    MDS        Added StandardFIle.Lib and fixed call to SaveAs().
  19. #     <1.0.6>    12/13/93    KTA        Save a file with the file name so the replaceExisting TCS will
  20. #                                    pass.
  21. #     <1.0.5>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  22. #                                    launchTwitch().
  23. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  24. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  25. #
  26. # ****************************************************************************
  27. #
  28.  
  29.  
  30.  
  31. ########################################################################
  32. #                            External libraries 
  33. #=======================================================================
  34. Libraries "StandardFile.Lib", "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  35.  
  36.  
  37. #########################################################################
  38. ########               Application Specific Tasks
  39. #########################################################################
  40.  
  41. #########################################################################
  42. #                        InitAppGlobals()
  43. #========================================================================
  44. # Author:        KA
  45. # Description:    Sets up tools and fonts for More.  This task
  46. #                must be called first.
  47. # Parameters:    None
  48. # Returns:        Nothing
  49. # Examples:        InitAppGlobals()
  50. #========================================================================
  51. # History:
  52. #
  53. ########################################################################
  54. task InitAppGlobals()
  55. begin
  56.     
  57.     logstr("setting up {global gApptitle}'s globals");            
  58.     global kClick, kDrag, kMultiDrag, kMultiClickDrag, kMultiClick;
  59.     global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal;
  60.     global kToolPaletteNum := 1; 
  61.     global kPatternPaletteNum := 0;
  62.     global kGradientPaletteNum := 0;
  63.  
  64.     global gWindowInset := {56,34,20,20};        # Window inset
  65.     global gScreenInset := {0,20,0,0};        # Screen inset
  66.     global gVoidRect := {};                    # Rect not to draw in - coordinates should be RelativeToWindow
  67.     global gTextStr;
  68.     
  69.     global gPaletteList :=    {
  70.                             {                        #### Start Palette # - Slide
  71.                             {0, 20, 41, 230,0},        # Location of palette relative to the window
  72.                             kPalDocWind,            # Palette type
  73.                             {2,10},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  74.                             {19,19}                    # Offset between tools {h,v}
  75.                             },                        #### End Palette #
  76.                             {                        #### Start Palette # - Outline
  77.                             {38, 53, 385, 62,0},        # Location of palette relative to the window
  78.                             kPalDocWind,            # Palette type
  79.                             {19,1},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  80.                             {18,0}                    # Offset between tools {h,v}
  81.                             },                        #### End Palette #
  82.                             {                        #### Start Palette # - Graphic
  83.                             {0, 26, 40, 195,0},        # Location of palette relative to the window
  84.                             kPalDocWind,            # Palette type
  85.                             {2,4},                    # Size of Tool matrix {numElemsWide,numElemsTall}
  86.                             {19,19}                    # Offset between tools {h,v}
  87.                             }                        #### End Palette #
  88. };
  89.  
  90.     ### MORE                                                                        {Flag, Pattern, Line, Color}
  91.     ### Palette Elements:=        Tool#, Pal#,     ToolName,     ToolType,    DblClktoEnd        SetAttributes
  92.     global Pointer             :=     { 1,  1,         "Pointer",    kClick,     0,                {0}                };    
  93.     global CharTool         :=     { 2,  1,         "Char",        kClick,        0,                {gTextStr}        };
  94.     global RectTool         :=     { 3,  1,         "Rect",        kDrag,         0,                {0}                };
  95.     global OvalTool         :=     { 4,  1,        "Oval",        kDrag,        0,                {0}                };
  96.     global RndRectTool         :=     { 5,  1,         "RndRect",    kDrag,        0,                {0}                };
  97.     global LineTool         :=     { 6,  1,        "Line",        kDrag,         0,                {0}                };
  98.     global MultiLine         :=     { 7,  1,         "MultiLine",kMultiClick,1,                {0}                };
  99.     global FreeTool         :=     { 8,  1,         "Freehand",    kMultiClick,1,                {0}                };
  100.  
  101.     global OutlineMode         :=     { 1,  {111,-7,2},     "OutlineMode",    0,    0,                {0}                };
  102.     global SlideMode         :=     { 1,  {126,-7,2},     "SlideMode",    0,    0,                {0}                };
  103.     global OverViewMode     :=     { 1,  {142,-7,2},     "OverViewMode",    0,    0,                {0}                };
  104.  
  105.     global OutlineList:={    
  106.                         Pointer, 
  107.                         CharTool,
  108.                         RectTool,
  109.                         OvalTool,
  110.                         RndRectTool,
  111.                         LineTool,
  112.                         MultiLine,
  113.                         FreeTool
  114.                         };
  115.                         
  116.     # global Tool list
  117.     global gToolList := OutlineList;
  118.     
  119.             ### font characteristic lists
  120.     global gFontSizeList := {'9','10','12','14','18', '24','36','48'};
  121.     global gFontStyleList := {}; # custom Mdef in More - VU can't select styles
  122.  
  123.         ### Name of the Plain (style) menu item  ####
  124.     global gPlainStyle := "";            # Plain-Style menu item (if this is set to the actual menuitem errors occur)
  125.  
  126.         ### How to get to the next line
  127.     global gNextLineMethod := 1;            
  128.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  129.     
  130.         ### Does moving to the next line clear all font info
  131.     global gNextLineClearsFontSettings := 1;                        
  132.  
  133. end; # InitAppGlobals
  134.  
  135. #########################################################################
  136. #                            MoreExample()
  137. #========================================================================
  138. # Author:        KTA (x45604)
  139. # Description:    Enters an MORE example
  140. # Parameters:    None
  141. # Returns:        Nothing
  142. # Examples:        MoreExample();
  143. # Assumptions:    None 
  144. # Applications:        MORE
  145. #========================================================================
  146. # History:
  147. #
  148. #########################################################################
  149. task MoreExample() begin
  150.     AutoList := {'Auto Purchase', 1, 'Get Loan', 1, 'Interest Rate','Principal','Payments', 2, 'Insurance','Warranty',1,'Color','Interior',1,'Stereo','Tinted Windows'};
  151.     println;
  152.     LogStr("MORE example");
  153.     
  154.     ## Make sure we are were we want to be
  155.     SetTool(Global OutlineMode);                # Go to the Outline 
  156.     SpecialKey(returnkey, 'Return key');        # Go to the next line
  157.     
  158.     for each item in autoList 
  159.     begin
  160.         if(TypeOf(item) = 'string')
  161.         begin
  162.             TypeStr(item);                # Type the next string
  163.             type k:{returnkey};            # Go To the Next line
  164.         end;
  165.         else                             # Stagger the Data
  166.         begin
  167.             if (item = 1) 
  168.                 SpecialKey(Tabkey, 'Tab Key');    # Move To the Right
  169.             else if (item = 2 ) 
  170.                 keyEq('l');                      # Move to the left
  171.         end;
  172.     end;
  173.     println;
  174. end;
  175.  
  176. ################################################################################
  177. ####################             Main script                    ####################
  178. ################################################################################
  179. script More (ScriptLevel:= -1)
  180. begin
  181.     InitGlobals(ScriptLevel);            # initialize your general globals
  182.     InitDraw();
  183.     InitFonts();
  184.     global gApptitle := "MORE";
  185.     global gAppVersion := '3';        # version of app you will be running
  186.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  187.     global gLaunchReqs := {'noCache'};
  188.     SuiteStart('MORE.vu');                    # begin a new test suite
  189.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  190.     begin
  191.         InitAppGlobals();                                    # init app specific globals
  192.         (*
  193.         *)
  194.         SaveAs(Global gFileName,, 1);    # So replace existing won't fail if the script hasn't been run on a HD yet.
  195.         CloseWindow();
  196.         SelectMenuItem('New', 'File');
  197.         
  198.         DoSetUpApp(,,,,1,1);
  199.         MoreExample();
  200.         DoText();            #Styles fail
  201.         DoWindow();            # Vertical scroll could fail if nothing in document
  202.         SetTool(global SlideMode);
  203.         DoDraw();
  204.         SetTool(global OverViewMode);
  205.         SetTool(global OutLineMode);
  206.         DoCloseApp(1,1);  
  207.         LogStr("############################# LIMITATIONS: ############################");
  208.         LogStr("NOTE: Selecting Styles does not function in MORE, custom MDEF");
  209.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  210.     SuiteEnd();
  211. end; # script More
  212.  
  213. ## Still needed
  214. # 1) If nothing is in the document the vertical scroll bar will not be enabled 
  215. #    and scrolling will not be performed as expected. DoWindow
  216. # 2) VU cannot select styles from the Styles menu ( VU bug??) Dotext
  217. # 3) Cannot Select colors, line and patterns through the popups because they disable VU.
  218. # 4) Plain is still selected (attempted) even though there are no styles in gFontStyleList - Dotext bug.
  219. # 5) Three clicks on a freehand tool will bring up a dialog - hopefully dbleClktoend is not seen as three